#pragma once

#include "IOperation.h"
#include "MsgBoxOperation.h"

const unsigned int MOD_NONE = 0x0000;

class HotKey
  {
  public:
    typedef unsigned int KeyCode;
    typedef unsigned int Modifier;

    HotKey(void);
    HotKey(int i_id, KeyCode i_vk_code, 
      HotKeyOperation::IOperation * ip_operation = 0,
      const std::wstring& i_name = std::wstring(),
      Modifier i_modifiers = MOD_NONE);
    ~HotKey(void);

    bool Register();
    bool Unregister();

    void Handle();

    // Setters
    void SetID(int i_id);
    void SetName(std::wstring & i_name);
    void SetVKCode(KeyCode i_vk_code);
    void SetModifiers(Modifier i_modifiers = MOD_NONE);
    void AddModifiers(Modifier i_modifiers);
    void RemoveModifiers(Modifier i_modifiers);
    
    // Getters
    int GetID() const;
    std::wstring GetName() const;
    unsigned int GetVKCode() const;
    unsigned int GetModifiers() const;
    bool GetIsRegistered() const;

    // Serialization
    friend boost::serialization::access;
    template <class Archive>
    void serialize(Archive & i_ar, const unsigned int i_version)
      {
      i_ar & m_id
        & m_name
        & m_vk_code
        & m_modifiers
        & mp_operation;
      }

  private:
    int m_id;
    std::wstring m_name;
    KeyCode m_vk_code;
    Modifier m_modifiers; 
    bool m_is_registered;
    boost::shared_ptr<HotKeyOperation::IOperation> mp_operation;
  };

bool operator==(const HotKey & i_hot_key_left, const HotKey & i_hot_key_right);